﻿using System;
using System.Collections.Generic;

namespace TheSnakeGame.Engine
{
    internal static class IListExtensions
    {
        public static void AddRange<T>(this IList<T> instance, IList<T> toAddCollection)
        {
            foreach (var item in toAddCollection)
            {
                instance.Add(item);
            }
        }
    }

    internal static class ArrayExtensions
    {
        public static void Initialize<T>(this T[,] arrayInstance, Func<int, int, T> initializer)
        {
            var x = arrayInstance.GetLength(0);
            var y = arrayInstance.GetLength(1);

            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    arrayInstance[i, j] = initializer(i, j);
                }
            }
        }
    }
}
